﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <?php include_http_metas() ?>
    <?php include_metas() ?>
    <?php include_title() ?>
    <link rel="shortcut icon" href="/favicon.ico" />
    <?php include_stylesheets() ?>
    <?php include_javascripts() ?>
  </head>
<body>
	<?php
	$module_type = $sf_context->getModuleName();
	$module = $sf_context->getRouting()->getCurrentRouteName();
	$sf_culture = $sf_context->getUser()->getCulture();
  ?>
<div id="divAdRight" style="DISPLAY: none;"></div> 
<div id="divAdLeft" style="POSITION: absolute; float:left; top:1000px; left:0px; width:100%; height:0px;background:#000;
	opacity: 0.9;
	filter: alpha(opacity = 90); z-index:1;
    display:none;"> 
	<div id="center" style="width:960px; margin:0 auto; display:none;">
	<a href="#" style="">Preview Products</a>       
	</div>
</div> 
<script> 
    function FloatTopDiv() 
    { 
        startLX = ((document.body.clientWidth -MainContentW)/2)-LeftBannerW-LeftAdjust , startLY = TopAdjust+80; 
        startRX = ((document.body.clientWidth -MainContentW)/2)+MainContentW+RightAdjust , startRY = TopAdjust+80; 
        var d = document; 
        function ml(id) 
        { 
            var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; 
            el.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';}; 
            el.x = startRX; 
            el.y = startRY; 
            return el; 
        } 
        function m2(id) 
        { 
            var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; 
            e2.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';}; 
            e2.x = startLX; 
            e2.y = startLY; 
            return e2; 
        } 
        window.stayTopLeft=function() 
        { 
            if (document.documentElement && document.documentElement.scrollTop) 
                var pY =  document.documentElement.scrollTop; 
            else if (document.body) 
                var pY =  document.body.scrollTop; 
            if (document.body.scrollTop > 300){startLY = 300;startRY = 300;} else {startLY = TopAdjust;startRY = TopAdjust;}; 
            ftlObj.y += (pY+startRY-ftlObj.y)/16; 
            ftlObj.sP(ftlObj.x, ftlObj.y); 
            ftlObj2.y += (pY+startLY-ftlObj2.y)/16; 
            ftlObj2.sP(ftlObj2.x, ftlObj2.y); 
            setTimeout("stayTopLeft()", 1); 
        } 
        ftlObj = ml("divAdRight"); 
        //stayTopLeft(); 
        ftlObj2 = m2("divAdLeft"); 
        stayTopLeft(); 
    } 
    function ShowAdDiv() 
    { 
        var objAdDivRight = document.getElementById("divAdRight"); 
        var objAdDivLeft = document.getElementById("divAdLeft");        
        if (document.body.clientWidth < 1000) 
        { 
            objAdDivRight.style.display = "none"; 
            objAdDivLeft.style.display = "none"; 
        } 
        else 
        { 
            objAdDivRight.style.display = "block"; 
            objAdDivLeft.style.display = "block"; 
            FloatTopDiv(); 
        } 
    }  
</script> 
<script> 
	document.write("<script type='text/javascript' language='javascript'>MainContentW = 1070;LeftBannerW = 140;LeftAdjust = 0;RightAdjust = 0;TopAdjust =350;ShowAdDiv();window.onresize=ShowAdDiv;;<\/script>"); 
</script>
<script type="text/javascript">
	//adding load class to body and hide page
	document.documentElement.className += 'loadstate';
	
	function sign_out()
	{
		$.ajax({
		  type: "POST",
		  url: "<?php echo url_for('@sf_guard_signout') ?>",
		  data: { is_log_out: 'yes' },
		  success: function(data) {
			window.location = "<?php echo url_for('@homepage?signout=success') ?>";
		  }
		});
	}
</script>
<div id="main-navigation">
<div id="menu">
    <?php vtnsMenu::render() ?>
</div>
<header class="page-header">
	<div class="header_wrapper">
    	<div class="logo">
        	<a href="<?php echo url_for("@homepage")?>">VTNS</a>
        </div>
        <div class="site-tools">
        	<ul class="header_menu">
            	<li class="expandable">
                	<span class="switch_language header_menu_item">
                        <a href="<?php echo url_for("@localized_homepage?sf_culture=vi")?>"><img class="<?php echo ($sf_culture=="vi")?"language_active":"" ?>" src="/images/vi.gif" /></a>
                        <a href="<?php echo url_for("@localized_homepage?sf_culture=en")?>"><img class="<?php echo ($sf_culture=="en")?"language_active":"" ?>" src="/images/en.gif" /></a>
                    </span>
                </li>
                <?php if ($sf_user->getGuardUser()) :?>
                    <li class="expandable has_dropdown">	
                    	<a href="#" class="header_menu_item">
                        	<span class="icon8 entypo-icon-users blue"></span>
                            <span class="txt blue"><? echo $sf_user->getGuardUser()->first_name." ".$sf_user->getGuardUser()->last_name; ?></span>
                        </a>
                    	<div class="dropdown_arrow"></div>
                        <ul class="meta-expansion">
                        	<li>
                            	<a href="<?php echo url_for("@sf_guard_user_object?id=".$sf_user->getGuardUser()->id."&action=edit")?>"><span class="icon8 entypo-icon-users"></span> My Profile</a>
                            </li>
                            <li>
                            	<a href="#"><span class="icon8 icomoon-icon-basket"></span> Orders</a>
                            </li>
                            <li>
                            	<a href="#" onclick="sign_out()"><span class="icon8 icomoon-icon-exit"></span> Logout</a>
                            </li>
                        </ul>
                    </li>
                <?php else : ?>
                    <li class="expandable">
                    	<a href="#loginPopup" data-toggle="modal" class="header_menu_item"><?php echo __("Login")?></a>
                    </li>
                    <li>
                        <a href="#registerPopup" data-toggle="modal"  class="header_menu_item"><?php echo __("Register")?></a>
                    </li>
                <?php endif; ?>
                
                <?php
					if ($sf_context->getUser()->hasAttribute("cart"))
						$cart_layout = $sf_context->getUser()->getAttribute("cart");
					else 
						$cart_layout = array();
				?>
                <li class="cart">
                	<a href="<?php echo url_for("@cart_list") ?>" data-toggle="modal" data-target="#cartPopup"><?php echo __("Cart")?></a>
                    <a href="<?php echo url_for("@cart_list") ?>" data-toggle="modal" data-target="#cartPopup" class="cart-page-count-checkout" id="link_to_cart"><?php echo count($cart_layout) ?></a>
                </li>
            </ul>
        </div>
    </div>
</header>
</div><!--End #main-navigation-->
<div id="header">
	<?php vtnsSlide::render() ?>
</div>
<div class="<?php echo $sf_context->getModuleName() ?>">
	<div id="wrapper" class="clearfix">
		<?php echo $sf_content; ?>
	</div>
</div>
<div id="footer">
<div>
	<ul class="coppy-right">
		<p class="company-name"><a href="<?php echo url_for("@homepage")?>">VTNS</a></p>
		<p>&copy; 2012 - Designed by <a href="http://vtns.vn" target="_blank">VTNS</a></p>
	</ul>
	<?php vtnsSlot::renderFooter() ?>
	<?php vtnsSlot::renderSocial() ?>
</div>
</div><!--End #footer-->
<?php if ($sf_context->getModuleName() != "default") : ?>
<script>
	$(document).ready(function()
	{		
		$('html, body').animate({
			 scrollTop:$("#wrapper").offset().top
		}, 500);	
	});
</script>
<?php endif; ?>

<div id="cartPopup" class="modal hide fade" style="display:none; ">
	<div class="modal-header">
    	<button type="button" class="close" data-dismiss="modal"><span class="icon12 minia-icon-close"></span></button>
    	<h3 class="blue">Cart</h3>
    </div>
    <div class="modal-body"></div>
    <div class="modal-footer">
    	<?php if ($sf_user->getGuardUser()) : ?>
    	<a class="btn btn-success" href="<?php echo url_for('@order')?>"><?php echo __('Order') ?></a>
        <?php else : ?>
        <a class="btn btn-success" href="#loginPopup" data-toggle="modal"><?php echo __("Order")?></a>
        <?php endif; ?>
    </div>
</div>

<?php if (!$sf_user->getGuardUser()) :?>
<div id="loginPopup" class="modal hide fade" style="display: none; ">
    <div class="modal-header">
      	<button type="button" class="close" data-dismiss="modal"><span class="icon12 minia-icon-close"></span></button>
      	<h3 class="blue">Login</h3>
    </div>
    <form action="<?php echo url_for('@sf_guard_signin') ?>" method="post">
    <div class="modal-body">
        <div class="paddingT15 paddingB15">    
            <?php $login_form = new sfGuardFormSignin() ?>
            
            <table>
                <tbody>
                	<?php echo $login_form ?>
                </tbody>
                <?php $routes = $sf_context->getRouting()->getRoutes() ?>
                <?php if (isset($routes['sf_guard_forgot_password'])): ?>
                <tfoot>
                	<tr>
                   		<td colspan="2">
                        	<a href="<?php echo url_for('@sf_guard_forgot_password') ?>"><?php echo __('Forgot your password?', null, 'sf_guard') ?></a>
                    	</td>
                  	</tr>
                </tfoot>
                <?php endif; ?>
			</table>
        </div>
    </div>
    <div class="modal-footer">
        <button type="submit" class="btn btn-danger"><?php echo __('Login', null, 'sf_guard') ?></button>
        <?php if (isset($routes['sf_guard_register'])): ?>
            <a class="btn btn-success" href="<?php echo url_for('@sf_guard_register')?>"><?php echo __('Register', null, 'sf_guard') ?></a>
        <?php endif; ?>
    </div>
    </form>
</div>

<div id="registerPopup" class="modal hide fade" style="display: none; ">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal"><span class="icon12 minia-icon-close"></span></button>
      <h3 class="blue">Register</h3>
    </div>
    <form id="register_form" class='frm_register' action="<?php echo url_for('@sf_guard_register') ?>" method="post">
    <div class="modal-body">
        <div class="paddingT15 paddingB15">
        	<table>
                <tbody>
                	<?php $register_form = new sfGuardRegisterForm() ?>
                	<?php echo $register_form ?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="modal-footer">
    	<button class="btn btn-danger" name="register"><?php echo __('Register', null, 'sf_guard') ?></button>
    </div>
    </form>
</div>

<script>
	$(document).ready(function()
	{
		$("#register_form").validate({
			rules: {
				"sf_guard_user[first_name]": "required",
				"sf_guard_user[last_name]": "required",
				"sf_guard_user[address]": "required",
				"sf_guard_user[tel]": "required",
				"sf_guard_user[username]": "required",
				"sf_guard_user[email_address]": {
					required: true,
					email: true
				},
				"sf_guard_user[password]": {
					required: true
				},
				"sf_guard_user[password_again]": {
					required: true,
					equalTo: "#sf_guard_user_password"
				}
			}
		});
		
		$("")
	});
</script>
<?php endif; ?>
<script>
	$(document).ready(function()
	{
		$(".meta-expansion li").hover(function()
		{
			$(this).find("span").addClass("blue");
		}, function() {
			$(this).find("span").removeClass("blue");
		});
		
		$(".sidenav li a").hover(function()
		{
			if (!$(this).hasClass("current"))
				$(this).find("span").addClass("blue");
		}, function() {
			if (!$(this).hasClass("current"))
				$(this).find("span").removeClass("blue");
		});
		
		$(".sidenav li a.current").find("span").addClass("blue");
	});
</script>
</body>
</html>